<div class="box dmsf_detail">
	<strong><%= l(:heading_new_revision) %> <a href="#" id="newRevisionFormContentToggle">[-]</a></strong>
		<div id="newRevisionFormContent">
			<% if @file.locked_for_user? %>
				<p class="warning"><%= l(:info_file_locked) %></p>
			<% else %>
<%
disabled_workflow = []
selected_workflow = nil
if !User.current.allowed_to?(:file_approval, @project)
	disabled_workflow << 2
	current_workflow = @file.last_revision.workflow
	if current_workflow == 1 || current_workflow == 2
		disabled_workflow << nil
		selected_workflow = 1
	end
else
	selected_workflow = @file.last_revision.workflow
end

form_for(:dmsf_file_revision, @revision, :url => {:action => "save_file", :id => @project, :file_id => @file},
	:html => {:method=>:post, :multipart => true}) do |f|
%>
				<div class="clear">
					<div class="splitcontentleft">
						<p>
							<%= label_tag("dmsf_file_revision_title", l(:label_title) + ":") %>
							<%= f.text_field(:title, :size => "32") %>
						</p>
					</div>
					<div class="splitcontentright">
						<p>
							<%= label_tag("", l(:label_filename) + ":") %>
							<%= h(@revision.name) %>
						</p>
					</div>
				</div>
				<p class="no-ident">
					<%= label_tag("dmsf_file_revision_description", l(:label_description) + ":") %>
				</p>
				<div class="wiki data clear">
					<%= f.text_area(:description, :rows=> "6", :class => "wiki-edit") %>
				</div>
				<div class="splitcontentleft">
					<p>
						<%= label_tag("fileMinorVersionRadio", l(:label_version) + ":") %>
					</p>
					<div class="data clear">
						<%= radio_button_tag("dmsf_file_revision[version]", "same", @revision.version == @file.last_revision.version, :id => "fileSameVersionRadio") %>
						<%= @file.last_revision.major_version %>.<%= @file.last_revision.minor_version %> <%= l(:option_version_same) %><br /> 
						<%= radio_button_tag("dmsf_file_revision[version]", "minor", 
								@revision.major_version == @file.last_revision.major_version && @revision.minor_version != @file.last_revision.minor_version,
								:id => "fileMinorVersionRadio") %> 
						<%= @file.last_revision.major_version %>.<%= @file.last_revision.minor_version + 1 %> <%= l(:option_version_minor) %><br />
						<%= radio_button_tag("dmsf_file_revision[version]", "major", @revision.major_version != @file.last_revision.major_version) %> 
						<%= @file.last_revision.major_version + 1 %>.0 <%= l(:option_version_major) %><br />
					</div>
					<p>
						<%= label_tag("dmsf_file_revision_workflow", l(:label_workflow) + ":") %>
						<%= f.select(:workflow, 
								options_for_select([
										[l(:option_workflow_none), nil], 
										[l(:option_workflow_waiting_for_approval), 1],
										[l(:option_workflow_approved), 2]], 
									:selected => selected_workflow, :disabled => disabled_workflow)) %>
					</p>
				</div>
				<div class="splitcontentright clear">
					<p>
						<%= label_tag("fileFileUpload", l(:label_new_content) + ":") %>
						<div class="data">
							<%= file_field_tag("dmsf_file_revision[file]", :size => 30, :id => "fileFileUpload") %>
							<br />
							<small>
								(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
							</small>
						</div>
					</p>
				</div>
				<br style="clear: both"/>
				<p>
					<%= label_tag("dmsf_file_revision_comment", l(:label_comment) + ":") %>
					<div class="data">
						<%= f.text_area(:comment, :rows=> "2", :style => "width: 99%;") %>
					</div>
				</p>
				<br />
				<%= submit_tag(l(:submit_create)) %>
<% end %>
			<% end %>
		</div>
</div>

<%= wikitoolbar_for "dmsf_file_revision_description" %>
